plotLineHisto <- function(inpath) {
## read in data
dat <- read.csv(inpath)

## load necessary packages
library(latticeExtra)

## define plot object
plot <- xyplot(dat$rh_wxt ~ as.POSIXct(dat$dateEAT) | dat$plotID,
             subset = dat$plotID != "", col = "blue",
             type="l", layout = c(1,2))

plot

## define and combine histograms
histomai1 <- histogram(dat$rh_wxt, freq=T, subset = dat$plotID == "mai1", xlab="mai1")

histocof3 <- histogram(dat$rh_wxt, freq=T, subset = dat$plotID == "cof3", xlab="cof3")

combohisto <- c(histomai1, histocof3, layout = c(2,1))

combohisto

## combine plot and histogram

combo <- c(combohisto, plot, layout = c(2,2))

combo

return(combo)

}

inpath <- "c:/tappelhans/uni/marburg/lehre/2011/ws/r_course/presentations/06_exercise/data/dataset_humidity.dat"

plotLineHisto(inpath)


